Optimal. Leaf size=89 \[ \left (a^2+b^2\right ) x+\frac {2 a b \log (\cosh (c+d x))}{d}-\frac {b^2 \tanh (c+d x)}{d}-\frac {a b \tanh ^2(c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}-\frac {b^2 \tanh ^5(c+d x)}{5 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 112, normalized size of antiderivative = 1.26, number of steps
used = 6, number of rules used = 4, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3742, 1824,
647, 31} \begin {gather*} -\frac {a b \tanh ^2(c+d x)}{d}-\frac {(a+b)^2 \log (1-\tanh (c+d x))}{2 d}+\frac {(a-b)^2 \log (\tanh (c+d x)+1)}{2 d}-\frac {b^2 \tanh ^5(c+d x)}{5 d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}-\frac {b^2 \tanh (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 647
Rule 1824
Rule 3742
Rubi steps
\begin {align*} \int \left (a+b \tanh ^3(c+d x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a+b x^3\right )^2}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=\frac {\text {Subst}\left (\int \left (-b^2-2 a b x-b^2 x^2-b^2 x^4+\frac {a^2+b^2+2 a b x}{1-x^2}\right ) \, dx,x,\tanh (c+d x)\right )}{d}\\ &=-\frac {b^2 \tanh (c+d x)}{d}-\frac {a b \tanh ^2(c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}-\frac {b^2 \tanh ^5(c+d x)}{5 d}+\frac {\text {Subst}\left (\int \frac {a^2+b^2+2 a b x}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=-\frac {b^2 \tanh (c+d x)}{d}-\frac {a b \tanh ^2(c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}-\frac {b^2 \tanh ^5(c+d x)}{5 d}-\frac {(a-b)^2 \text {Subst}\left (\int \frac {1}{-1-x} \, dx,x,\tanh (c+d x)\right )}{2 d}+\frac {(a+b)^2 \text {Subst}\left (\int \frac {1}{1-x} \, dx,x,\tanh (c+d x)\right )}{2 d}\\ &=-\frac {(a+b)^2 \log (1-\tanh (c+d x))}{2 d}+\frac {(a-b)^2 \log (1+\tanh (c+d x))}{2 d}-\frac {b^2 \tanh (c+d x)}{d}-\frac {a b \tanh ^2(c+d x)}{d}-\frac {b^2 \tanh ^3(c+d x)}{3 d}-\frac {b^2 \tanh ^5(c+d x)}{5 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.50, size = 95, normalized size = 1.07 \begin {gather*} -\frac {15 \left ((a+b)^2 \log (1-\tanh (c+d x))-(a-b)^2 \log (1+\tanh (c+d x))\right )+30 b^2 \tanh (c+d x)+30 a b \tanh ^2(c+d x)+10 b^2 \tanh ^3(c+d x)+6 b^2 \tanh ^5(c+d x)}{30 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.32, size = 99, normalized size = 1.11
method | result | size |
derivativedivides | \(\frac {-\frac {b^{2} \left (\tanh ^{5}\left (d x +c \right )\right )}{5}-\frac {b^{2} \left (\tanh ^{3}\left (d x +c \right )\right )}{3}-a b \left (\tanh ^{2}\left (d x +c \right )\right )-b^{2} \tanh \left (d x +c \right )-\frac {\left (a^{2}+2 a b +b^{2}\right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \ln \left (1+\tanh \left (d x +c \right )\right )}{2}}{d}\) | \(99\) |
default | \(\frac {-\frac {b^{2} \left (\tanh ^{5}\left (d x +c \right )\right )}{5}-\frac {b^{2} \left (\tanh ^{3}\left (d x +c \right )\right )}{3}-a b \left (\tanh ^{2}\left (d x +c \right )\right )-b^{2} \tanh \left (d x +c \right )-\frac {\left (a^{2}+2 a b +b^{2}\right ) \ln \left (\tanh \left (d x +c \right )-1\right )}{2}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \ln \left (1+\tanh \left (d x +c \right )\right )}{2}}{d}\) | \(99\) |
risch | \(a^{2} x -2 a b x +b^{2} x -\frac {4 a b c}{d}+\frac {2 b \left (30 a \,{\mathrm e}^{8 d x +8 c}+45 b \,{\mathrm e}^{8 d x +8 c}+90 a \,{\mathrm e}^{6 d x +6 c}+90 b \,{\mathrm e}^{6 d x +6 c}+90 a \,{\mathrm e}^{4 d x +4 c}+140 b \,{\mathrm e}^{4 d x +4 c}+30 a \,{\mathrm e}^{2 d x +2 c}+70 b \,{\mathrm e}^{2 d x +2 c}+23 b \right )}{15 d \left (1+{\mathrm e}^{2 d x +2 c}\right )^{5}}+\frac {2 a b \ln \left (1+{\mathrm e}^{2 d x +2 c}\right )}{d}\) | \(163\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 194 vs.
\(2 (85) = 170\).
time = 0.48, size = 194, normalized size = 2.18 \begin {gather*} \frac {1}{15} \, b^{2} {\left (15 \, x + \frac {15 \, c}{d} - \frac {2 \, {\left (70 \, e^{\left (-2 \, d x - 2 \, c\right )} + 140 \, e^{\left (-4 \, d x - 4 \, c\right )} + 90 \, e^{\left (-6 \, d x - 6 \, c\right )} + 45 \, e^{\left (-8 \, d x - 8 \, c\right )} + 23\right )}}{d {\left (5 \, e^{\left (-2 \, d x - 2 \, c\right )} + 10 \, e^{\left (-4 \, d x - 4 \, c\right )} + 10 \, e^{\left (-6 \, d x - 6 \, c\right )} + 5 \, e^{\left (-8 \, d x - 8 \, c\right )} + e^{\left (-10 \, d x - 10 \, c\right )} + 1\right )}}\right )} + 2 \, a b {\left (x + \frac {c}{d} + \frac {\log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{d} + \frac {2 \, e^{\left (-2 \, d x - 2 \, c\right )}}{d {\left (2 \, e^{\left (-2 \, d x - 2 \, c\right )} + e^{\left (-4 \, d x - 4 \, c\right )} + 1\right )}}\right )} + a^{2} x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 2074 vs.
\(2 (85) = 170\).
time = 0.35, size = 2074, normalized size = 23.30 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.16, size = 100, normalized size = 1.12 \begin {gather*} \begin {cases} a^{2} x + 2 a b x - \frac {2 a b \log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d} - \frac {a b \tanh ^{2}{\left (c + d x \right )}}{d} + b^{2} x - \frac {b^{2} \tanh ^{5}{\left (c + d x \right )}}{5 d} - \frac {b^{2} \tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac {b^{2} \tanh {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tanh ^{3}{\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.43, size = 142, normalized size = 1.60 \begin {gather*} \frac {30 \, a b \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) + 15 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} {\left (d x + c\right )} + \frac {2 \, {\left (23 \, b^{2} + 15 \, {\left (2 \, a b + 3 \, b^{2}\right )} e^{\left (8 \, d x + 8 \, c\right )} + 90 \, {\left (a b + b^{2}\right )} e^{\left (6 \, d x + 6 \, c\right )} + 10 \, {\left (9 \, a b + 14 \, b^{2}\right )} e^{\left (4 \, d x + 4 \, c\right )} + 10 \, {\left (3 \, a b + 7 \, b^{2}\right )} e^{\left (2 \, d x + 2 \, c\right )}\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{5}}}{15 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.16, size = 91, normalized size = 1.02 \begin {gather*} x\,\left (a^2+2\,a\,b+b^2\right )-\frac {b^2\,\mathrm {tanh}\left (c+d\,x\right )}{d}-\frac {b^2\,{\mathrm {tanh}\left (c+d\,x\right )}^3}{3\,d}-\frac {b^2\,{\mathrm {tanh}\left (c+d\,x\right )}^5}{5\,d}-\frac {2\,a\,b\,\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )}{d}-\frac {a\,b\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________